#include <iostream>
using namespace std;

int l, r, cnt;

int main()
{
	cin >> l >> r;
	for (int i = l; i <= r; i++)
	{
		int x = i;
		while (x)
		{
			int n = x % 10;
			if (n == 2)
				cnt++;
			x /= 10;
		}
	}
	
	cout << cnt << endl;
	
	return 0;
}
